﻿using System.Collections.Generic;
using DeepEarth.Map.Core;
using System;
using System.Linq;
using DeepEarth.Core.Utilities;
using DeepEarth.Core;
namespace DeepEarth.Map.Core.Utilities
{
    public static class MultiLocationHelper
    {
        /// <summary>
        /// Gets the locations from all the specified <paramref name="containers"/>.
        /// </summary>
        /// <param name="containers">The collection of the locations containers.</param>
        /// <returns>A flatten list of the locations from all the specified <paramref name="containers"/>.</returns>
        public static IEnumerable<Location> GetLocations(this IEnumerable<IMultiLocation> locatables)
        {
            if (locatables == null) throw new ArgumentNullException("containers");
            return locatables.SelectMany(x => x.Locations);
        }
    }
}
